/**
 * 
 */
package com.ms.service.module.gamelog;

import com.ms.service.module.zone.command.BasicDebugCommand;
import com.xpec.c4.service.module.BasicServiceModule;
import com.xpec.c4.service.module.ModuleName;
import com.xpec.c4.service.module.ModuleServer;

/**
 * 將暫存的文字 log 寫入 db
 * 
 * @author TW15010
 */
public class FlushDbLogCommand extends BasicDebugCommand {
	@Override
	public String execute() {
		BasicServiceModule module = ModuleServer.getInstance().getBasicServiceModule(ModuleName.GAMELOG);
		if (module == null) {
			return "fail: game log module not found.";
		}

		if (!(module instanceof GameLogModule)) {
			return "fail: module is not game log module.";
		}

		GameLogModule logModule = (GameLogModule) module;

		if (logModule.isLogProcRunning()) {
			return "fail: process already running..";
		}
		
		logModule.onLogProcTaskTimer();
		
		return "ok";
	}

	@Override
	public String getName() {
		return "flushdblog";
	}

	@Override
	public String getDescription() {
		return "no param.";
	}

	@Override
	public String getShortDescription() {
		return "write temp text log to db.";
	}
}
